<?php
@session_start();
$ROOT = "";
require_once ('config/config.php');

class index{
	
	function insert($db){
		$miguel = new User('','Saúal','saul.marrufo@gmaila.com','', 'sauli', md5('saul'), 1, '', '');
		
		$test = User::insertUser($db,$miguel);
	
	}
	
	function obtain($db,$id,$smarty){
		$user=& User::getUser($db,$id);
		
		index::displayed($db,$smarty,'Mostrar');
	}
	
	
	function displayed($db,$smarty,$test){
		$result = Publication::getList($db);
		$smarty-> assign('PublicationList',$result);
					
		$smarty->assign('name'	, htmlentities($test));
		$smarty->display('../templates/index.tpl');
	}
	
	function main($db,$param,$smarty){
		$index = new index();
		switch ($param){
			case 1:
				$index -> obtain($db,1,$smarty);		
				break;
			case 2:		
				$index -> insert($db);
				break;
			
			default:
				$index -> displayed($db,$smarty,"Test");
		}
	}
}

$param = $_POST['param'];
index::main($db,$param,$smarty);

?>